

var OTHERS_HINT = document.getElementById("othersHint");
var OTHERS_LIST = document.getElementById("othersList");
var OTHERS_VALUE = document.getElementById("othersValue");
var OTHERS_AREOBJECTS = document.getElementById("othersAreObjects");



function pimoWizardLoad() {
	
	//display the URL of the web page
	document.getElementById("labelPageURL").value = CURRENT_URL;
	
	
	// Clear the othersList.rdf file.
	run(true, ["clearOthersList"]);
	
	
	// Load the propertiesList. TODO: to be changed
	var args = ["getAllPropertiesOf", "http://www.semanticdesktop.org/ontologies/2007/11/01/pimo", "http://www.semanticdesktop.org/ontologies/2007/11/01/pimo#Thing", "http://www.semanticdesktop.org/ontologies/2007/11/01/pimo#Thing" ];
	
	run(true, args);
	
	run(true, ["getThingNameOfResource", CURRENT_URL]);
	
	var res = success(PATH_CONTENT + "thingName.txt", "No existing name, enter one.");
	
	if (res != null) {
		document.getElementById("currentThingName").value = res;
	} else {
		// TODO
	}
	
}


function page1Show() {
	
	//document.getElementById("Nepomuk-ff-tag").canAdvance="true";
	document.getElementById("propertiesList").builder.refresh();
	document.getElementById("othersList").builder.refresh();
	
}


function propertiesListClick(event) {
	
	// document.getElementById("relationsList").dataSources = "/home/nicolas/.mozilla/firefox/uft1uj8a.Nicolas/extensions/firefox%40nepomuk.org/chrome/content/tagsCache.rdf";
	//alert (document.getElementById("propertiesList"));
	
	var list = document.getElementById("propertiesList");
	property_uri = list.selectedItem.childNodes[1].getAttribute("label");
	//alert(property_uri);
	
	var args = [ "getPossibleRangeElementsFor", property_uri ];
	run(true, args);
	
	var othersList = document.getElementById("othersList");
	othersList.builder.refresh();
	
}


function othersListClick(event) {
	
	// document.getElementById("relationsList").dataSources = "/home/nicolas/.mozilla/firefox/uft1uj8a.Nicolas/extensions/firefox%40nepomuk.org/chrome/content/tagsCache.rdf";
	//alert (document.getElementById("propertiesList"));
	
	var list = document.getElementById("othersList");
	property_uri = list.selectedItem.childNodes[1].getAttribute("label");
	
}


function deleteProperty(event) {
	
	// TODO
	
}


function othersAreObjects () {
	
	OTHERS_HINT.setAttribute("value", "Other possible elements:");
	OTHERS_LIST.setAttribute("hidden", false);
	OTHERS_VALUE.setAttribute("hidden", true);
	
}


function othersAreValues () {
	
	OTHERS_HINT.setAttribute("value", "Enter a value:");
	OTHERS_LIST.setAttribute("hidden", true);
	OTHERS_VALUE.setAttribute("hidden", false);
	
}


function wizardFinish() {
	
	if (OTHERS_AREOBJECTS.getAttribute("selected")) {
		// Register the property between current page and the selected object.
		
		
		
	} else {
		// Register the DescribingProperty to describe the current page with the given value.
		
		
		
	}
	
}









